
import { ThemeEnum } from '@/enums/app_enum';
import storageUtil from './storage_util';

console.log('%c [ Storage ]-5', 'font-size:13px; background:pink; color:#bf2c9f;', storageUtil)
export async function updateTheme(mode: string | null) {
  const htmlRoot = document.getElementById('html_root');
  if (!htmlRoot) {
    return;
  }
  if (mode === ThemeEnum.LIGHT) {
    storageUtil.set('data-theme', ThemeEnum.LIGHT)
    htmlRoot.setAttribute('data-theme', ThemeEnum.LIGHT);
  } else if (mode === ThemeEnum.DARK) {
    storageUtil.set('data-theme', ThemeEnum.DARK)
    htmlRoot.setAttribute('data-theme', ThemeEnum.DARK);
  } else {
    storageUtil.set('data-theme', ThemeEnum.DEFAULT)
    htmlRoot.setAttribute('data-theme', ThemeEnum.DEFAULT);
  }



}
